<template>
    <div style="background-color: #c7c7c7;">
    <x-header>浏览记录</x-header>
    <flexbox orient="vertical">

    <flexbox-item v-for="(u,index) in ulist" :key="index">
    <div class="flex-demo">
    <div>
    <div class="namebox">
    <div class="namemsg">
    <img class="touxiang" :src="u.User_tx" alt="">
    <div class="Tname">
    <span class="name">{{u.User_name}}</span>
    <span class="time">{{u.Tz_time}}</span>  
    </div>  
    </div>
    </div>

    <p class="Title">
      {{u.Tz_text}}
    </p>
    <span class="Type">#{{u.Tz_type}}</span>
    <div class="Timg">
    <img slot="icon" v-for="(img,index) in u.Tz_img" :key="index" :src="'http://localhost:3000/'+img" width="30%" :preview='u.Tz_text' :preview-text="u.Tz_text">
    </div>

    <div class="Tclick">
    <router-link class="rline" :to="'/Postdetails/' + id +'/'+ u._id">
    <div class="Tmsg">
    <img slot="icon" src="static/img/msg.png" width="30">
    <p>{{u.Pl}}</p>
    </div>
    </router-link>
    <div class="Tlike" @click="tolike('点赞的人',u.Tz_likeuser)">
    <img slot="icon" src="static/img/like.png" width="30">
    <p v-if="u.Tz_like>0">{{u.Tz_like}}</p>
    </div>
    <div class="Tunlike" @click="tolike('点踩的人',u.Tz_unlikeuser)">
    <img slot="icon" src="static/img/unlike.png" width="30">
    <p v-if="u.Tz_like<0">{{u.Tz_like}}</p>
    </div>
    </div>
    </div>
    </div>
    </flexbox-item>
    </flexbox>
    <br><br><br>
  </div>
</template>
<script>
import { TransferDom } from 'vux'
export default {
    directives: {
    TransferDom
    },
    data () {
    return {
      id:this.$store.state.wd.wdid,
      ulist:[],
    }
  },
    methods: {
    getutz(){
        var that = this;
        var id = this.$store.state.wd.wdid;
        this.$http.post("http://localhost:3000/post/Userlook",//浏览记录
        {
        list: this.$store.state.wd.looklist,
        },{emulateJSON: true})
        .then(
        (response)=>{
            this.ulist=response.data;
            this.$vux.loading.hide();
        },
        (error)=>{
        console.log("err");
        });
    },
    tolike(like,list){
      if(list!=''){
      this.$router.push('/Likeuser/' + like +'/'+ list);
      }else{
      this.$vux.toast.show({
            type: 'text',
            text: '没有人哦',
            position: 'middle',
            time: '1000'
            })
      }
    },
  },
  mounted(){
    this.$vux.loading.show();
    this.getutz()
  }
  
}
</script>

<style lang="less" scoped>
@import '~vux/src/styles/1px.less';

.rline{
text-decoration:none;  /*超链接无下划线*/
}
.flex-demo {//帖子css
  width: 100%;
  background-color: #f8f6f6;
  border-radius: 4px;
  background-clip: padding-box;

  display: flex;
  display: -webkit-flex;
  flex-direction: column;
}
.namebox{
  margin-top: 10px;
  display: flex;
  justify-content:space-between;
  align-items:center;
}
.namemsg{
  margin-left: 20px;
  display: flex;
  flex-direction: row;
  justify-content:flex-start;
  width: 70%;
}
.Tname{
  display: flex;
  flex-direction: column;
}
.touxiang{
    background-color: aliceblue;
    border-radius: 50%;
    height: 50px;
    width: 50px;
    margin-right: 20px;
}
.name{
  margin-bottom: 5px;
  width: 200px;
  color: rgb(59, 59, 59);
  font-size: 14px;
  white-space:nowrap; 
  text-overflow:ellipsis;
  overflow:hidden;
}
.time{
  color: rgb(88, 88, 88);
  font-size: 12px;
}
.gz{
  margin-right: 20px;
  white-space:nowrap; 
    background-color: white; 
    color: black; 
    border: 2px solid #008CBA;
    border-radius: 15px;
    font-size: 12px;
    padding: 5px 15px;

}
.Tclick{
  display: flex;
  align-items:center;
  justify-content:space-around;
  margin-bottom: 10px;
  margin-top: 10px;
}
.Tmsg{
  display: flex;
  align-items:center;
  justify-content:space-around;
}
.Tlike{
  display: flex;
  align-items:center;
  justify-content:space-around;
}
.Tunlike{
  display: flex;
  align-items:center;
  justify-content:space-around;
}


.Title{
margin-left: 20px;
margin-right: 20px;
// display: -webkit-box;    
// -webkit-box-orient: vertical;    
// -webkit-line-clamp: 3;    
// overflow: hidden;
}
.Timg{
margin: 20px;
}
.Type{
    margin-left: 20px;
    padding-left: 10px;
    padding-right: 10px;
    padding-bottom: 2px;
    padding-top: 2px;
    font-size: 12px;
    color: #008CBA;
    border: 2px solid #008CBA;
    border-radius: 5px;
}
</style>